#include<stdio.h>
#include<unistd.h> //execl
#include<stdlib.h> //fork
#include<sys/wait.h> //waitpid
#include<sys/types.h> //pid_t
int main(){
    putenv("XXX=666");
    pid_t id=fork();
    if(id==0){
        printf("before execl\n");
        // execl("/usr/bin/ls","ls","-a","-l",NULL);     //调用指令
        execl("./proccpp","proccpp",NULL);            //调用C++可执行程序
        // execl("/usr/bin/bash","bash","test.sh",NULL); //调用shell脚本
        printf("after execl\n");
        exit(0);
    }
    pid_t ret=waitpid(id,NULL,0);
    if(ret>0){
        printf("wait success\n");
    }
    return 0;
}
